import React, { FC } from 'react';

import { CoolTemplateDetail } from './template/CoolTmplateDetail';

if (process.env.BROWSER) {
    require('./resume-detail.scss');
}

const TemplateMapping = {
    Cool: CoolTemplateDetail,
};

const COM_PREKEY = 'ResumeDetail';

interface ResumeDetailProps {
    templateName: string;
    // #TODO make this typely
    templateData: any;
    /**
     * template style (use css)
     */
    templateStyle?: string;
}

const ResumeDetail: FC<ResumeDetailProps> = (props) => {
    const Template = TemplateMapping?.[props.templateName] ?? CoolTemplateDetail;

    return <Template {...props.templateData} />;
};

ResumeDetail.displayName = 'ResumeDetail';

export { ResumeDetail, ResumeDetailProps };
